

package basedatos;
import java.sql.*;


public class conectate {

   static String bd = ""; 
   static String login = ""; 
   static String password = ""; 
   static String url = "jdbc:derby://localhost:1527/"+bd; 
 
   Connection conn = null; 
    
   public conectate() { 
      try{          
         Class.forName("org.apache.derby.jdbc.ClientDriver");          
         conn = DriverManager.getConnection(url,login,password); 
         if (conn!=null){ 
            System.out.println("Conección a base de datos "+bd+". listo"); 
         } 
      }catch(SQLException e){ 
         System.out.println(e); 
      }catch(ClassNotFoundException e){ 
         System.out.println(e); 
      } 
   } 
    
   public Connection getConnection(){ 
      return conn; 
   } 
 
   public void desconectar(){ 
      conn = null; 
   } 



}




    
 
    
